var dzt_local = chrome.storage.local;

function getUrlKey(url, name) {
    return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(url) || ['', ''])[1].replace(/\+/g, '%20')) || null;
}

dzt_local.get('dzt_sosuo_update', function (data) {
    if (data.dzt_sosuo_update && JSON.stringify(data.dzt_sosuo_update) != '{}') {
        if (data.dzt_sosuo_update.update.split('_')[1] == 'ON') {
            dzt_local.get('dzt_sosuo_data', function (res) {
                if (res.dzt_sosuo_data) {
                    res = res.dzt_sosuo_data;
                }

                if (check_domain()) {
                    var dsy_product_list = ['电商易', '学电商', '旺参谋', '旺探长', '店数据', '看电商', '卖家导航', '电商工具', '数据分析工具', '淘宝商家数据'];
                    var hyk_set_top_text_list = ['火眼看', '短视频助手', '乐观数据', '短视频分析', '短视频运营', '抖音热搜', '短视频榜单'];
                    var ddc_set_top_text_list = ['多多查', '拼多多数据分析', '拼多多数据', '拼多多排名', '拼多多运营', '拼多多销量', '拼多多生意参谋', '拼多多商品排名', '拼多多来源词',
                        '拼多多关键词', '山鸡工具', '拼多多工具', '多多卖家通', '多多联盟', '拼多多查排名', '拼多多标题', '拼多多行业数据', '拼多多参谋', '拼多多指数', '拼多多权重', '拼多多sku',
                        '拼多多精灵', '拼多多流量', '拼多多推广', '拼多多店铺权重', '拼多多来源词', '店霸', '河鱼工具', '河鱼软件', '拼多多河鱼', '多多卖家通', '多多联盟', '多多雷达', '多多参谋'];
                    var dsyan_set_top_text_list = ['抖商眼', '抖商数据', '抖商', '抖音爆款', '抖音品牌排行榜', '抖音排行榜', '抖音红人排行', '抖音好物榜', '卡思数据', '抖音商品', '抖音带货',
                        '抖音达人销量榜', '抖音参谋', '抖音达人', '抖音分类排行榜', '抖音电商', '抖音带货课程', '抖商大学', '抖参谋', '抖音打造爆款', '抖音如何做爆款', '抖音热门预测', '抖大大', '抖音排行榜',
                        '抖音数据', '抖音粉丝分析', '怎么在抖音找主播合作卖货', '抖音竞品分析', '抖商学院', '抖音运营', '抖音助手', '秒派', '抖音直播排行', '抖音热榜排行', '抖音销量排行榜', '抖音热门话题',
                        '抖音热门视频', '抖音广告分析'];
                    var kdb_set_top_text_list = ['看店宝', '51啦领', '琳琅秀', 'dsr 评分', 'dsr动态评分', 'dsr计算', 'dsr评分', 'dsr淘宝', '查dsr', '动态DSR', '淘宝查动态分', '淘宝店铺动态',
                        '淘宝动态评分', '淘宝动态分', '天猫dsr', '淘大象', '提高dsr', '淘宝交易量查询', '宝贝分析', '宝贝信息查询', '淘宝商品价格', '淘宝价格走势', '淘宝查交易量', '淘宝交易量', '商品价格走势',
                        '宝贝成交量查询', '宝贝信息查询', '热销宝贝销量查询', '宝贝上新查询', '淘宝20万词表', '淘宝热销关键词', '淘宝关键词分析', '20万词表', '20w词表', '淘宝标题选词', '淘宝选词',
                        '淘宝热词软件', '直通车词表', '淘宝下拉框选词', '关键词组合标题', '关键词工具', '淘宝词根组合', '标题关键词优化', '关键词权重', '淘宝查权重', '隐形降权', '商品降权查询',
                        '查询降权', '淘宝降权', '查降权', '商品降权', '产品降权', '店铺查降权', '店铺降权', '淘大客', '淘宝降权', '天猫实时数据', '淘宝搜索排名', '天猫商城数据', '天猫数据', '天猫分析',
                        '淘宝宝贝分析', '试客网', '试客秀', '淘宝好评采集', '淘大兔', '实时查排名', '直通车工具', '直通车排名', '直通车推广', '关键词排名', '无线端查排名', '宝贝排名查询', '店铺排名查询',
                        '直通车软件'];
                    var dzt_set_top_text_list = ['店侦探', '今日销量', '淘宝实时销量', '店查查', '店透视', '淘宝sku销售', '淘宝sku评价', '宝贝SKU销量', '宝贝SKU评价', 'sku具体销量', '引流关键词'];
                    var xws_set_top_text_list = [
                        '指数转化', '指数转换', '指数还原', '生意参谋', '验号', '今日付款', '生意参谋指数', '生意参谋指数转化', '生意参谋指数换算工具', '生意参谋指数转换工具', '创客工具', '创客', '流量参谋',
                        '店透视', '爆款指数', '打造爆款', '淘宝商品指数', '淘宝指数', '淘宝分析', '天猫数据分析', '淘宝卖家分析', '淘宝类目分析', '降权查询', '买家号查询', '旺旺号降权', '旺旺号查询',
                        '照妖镜查号', '创客查号', '查旺旺号', '账号降权', '查号降权', '淘大象', '查询旺旺号', '查询买家信誉', '淘宝买家查询信誉', '旺旺查询', '卡首屏', '魔搜', '小旺神',
                        '评论下载', '追评下载', '评价数据', '买家秀下载', '评价视频', '主图下载', '淘宝图片下载', '主图视频', '查淘客', '淘客订单', '淘宝客订单', '淘客查询', '淘指数', '转化率指数',
                        '指数换算', '成交转化率指数', '今日付款人数', '实时付款人数', '阿明工具', '运营大神', '晓工具箱', '验小号', '直通车指数', '无邪工具'
                    ];
                    var keywords_list = {
                        'dsy': dsy_product_list,
                        'xws': xws_set_top_text_list,
                        'ddc': ddc_set_top_text_list,
                        'hyk': hyk_set_top_text_list,
                        'dzt': dzt_set_top_text_list,
                        'kdb': kdb_set_top_text_list,
                        'dsyan': dsyan_set_top_text_list,
                    }
                    var rivals_list = ['山鸡工具', '乐观数据', '店霸', '河鱼工具', '河鱼软件', '拼多多河鱼', '多多卖家通', '多多联盟', '多多雷达', '抖大大', '秒派', '51啦领', '琳琅秀', '淘大客',
                        '淘大象', '试客网', '试客秀', '淘大兔', '店查查', '店透视', '阿明工具', '运营大神', '晓工具箱', '验小号', '创客']
                    try {
                        if (res.kws) {
                            for (var pType in res.kws) {
                                if (!keywords_list[pType]) {
                                    keywords_list[pType] = []
                                }
                                for (var i = 0; i < res['kws'][pType].length; i++) {
                                    if (!keywords_list[pType].includes(res['kws'][pType][i])) {
                                        keywords_list[pType].push(res['kws'][pType][i])
                                    }
                                }
                            }
                        }
                    } catch (e) {

                    }
                    try {
                        if (res.rivals) {
                            for (var i = 0; i < res.rivals.length; i++) {
                                if (!rivals_list.includes(res['rivals'][i])) {
                                    rivals_list.push(res['rivals'][i])
                                }
                            }
                        }
                    } catch (e) {

                    }

                    // 适配网址
                    function init_main() {
                        var so_load_type = false;
                        if (window.location.href.indexOf('www.baidu.com/s?') >= 0) {
                            so_load_type = true;
                            baidusetTop();
                        } else if (window.location.href.indexOf('www.so.com/s?') >= 0) {
                            so_load_type = true;
                            soSetTop();
                        } else if (window.location.href.indexOf('www.sogou.com/web?') >= 0 || window.location.href.indexOf('www.sogou.com/sie?') >= 0 || window.location.href.indexOf('www.sogou.com/sogou?') >= 0) {
                            so_load_type = true;
                            sogouSetTop();
                        } else if (window.location.href.indexOf('//cn.bing.com/search?') >= 0) {
                            so_load_type = true;
                            bingSetTop();
                        }
                        try {
                            if (res.i_m && !so_load_type) {
                                var im_data = res.i_m;
                                for (var itype in im_data) {
                                    for (var i = 0; i < im_data[itype].length; i++) {
                                        if (window.location.href.indexOf(im_data[itype][i]) >= 0) {
                                            if (itype == 'bd') {
                                                baidusetTop();
                                            } else if (itype == 'so') {
                                                soSetTop();
                                            } else if (itype == 'sogou') {
                                                sogouSetTop();
                                            } else {
                                                bingSetTop();
                                            }
                                            so_load_type = true;
                                            return;
                                        }
                                    }
                                }
                            }
                        } catch (e) {

                        }

                        setTimeout(function () {
                            init_main();
                        }, 500);
                    }

                    init_main();

                    // 百度置顶
                    function baidusetTop() {
                        var wd = getUrlKey(window.location.href, 'wd');
                        try {
                            if (wd) {
                                wd = wd.replace(/\s*/g, "");
                            }
                        } catch (e) {
                        }
                        var $content_left = $('#content_left');
                        if (setTopType(wd) || matchlink($content_left.find('a,.c-showurl'))) {

                            // 删除广告
                            for (var i = 0; i < $('#content_left>div').length; i++) {
                                if ($('#content_left>div').eq(i).attr('cmatchid') || $('#content_left>div').eq(i).find('div').attr('cmatchid')) {
                                    $('#content_left>div').eq(i).remove();
                                }
                            }
                            if ($content_left.find('.ec_tuiguang_pplink').length) {
                                $content_left.find('.ec_tuiguang_pplink').parent('div.f13').parent('div').remove();
                            }
                            if ($('#content_left>div').attr('cmatchid')) {
                                $content_left.find('div[cmatchid="' + $content_left.find('div').attr('cmatchid') + '"]').remove();
                            }
                            // 添加或置顶div
                            if (!$content_left.find('.xws-top').length) {
                                if (matchlink($content_left.find('.c-showurl'))) {
                                    for (var i = 0; i <= $content_left.find('.c-container').length; i++) {
                                        if (matchlink($content_left.find('.c-container').eq(i).find('.c-showurl'))) {
                                            if (!$content_left.find('.c-container').eq(0).hasClass('xws-top')) {
                                                var Html = $content_left.find('.c-container').eq(0).html();
                                                $content_left.find('.c-container').eq(0).html($content_left.find('.c-container').eq(i).html()).addClass('xws-top');
                                                $content_left.find('.c-container').eq(i).html(Html);
                                            } else {
                                                if (i == $content_left.find('.c-container').length) {
                                                    $content_left.find('.c-container').eq(i).addClass('xws-top');
                                                } else {
                                                    var Html = objHtml($content_left.find('.c-container').eq(i), 'div');
                                                    $content_left.find('.c-container').eq(i).remove();
                                                    $content_left.find('.xws-top').eq(-1).after(Html);
                                                }
                                            }
                                        }
                                    }
                                } else {
                                    if ($content_left.find('#rs_top_new').length) {
                                        $content_left.find('#rs_top_new').after(setTopHtml('bd', wd));
                                    } else {
                                        $content_left.prepend(setTopHtml('bd', wd));
                                    }
                                }
                            }
                        }
                    }

                    // 360置顶
                    function soSetTop() {
                        var q = getUrlKey(window.location.href, 'q');
                        try {
                            if (q) {
                                q = q.replace(/\s*/g, "");
                            }
                        } catch (e) {
                        }
                        if (setTopType(q) || matchlink($('#main .res-linkinfo,#main .e_haoso_fengwu_extend cite'))) {
                            $('#main .e-buss,#side_wrap .e-buss').remove();
                            if (!$('#main .xws-top').length) {
                                if (matchlink($('#main .res-linkinfo'))) {
                                    var $res_list = $('#main ul.result .res-list');
                                    var res_len = $res_list.length;
                                    for (var i = 0; i <= res_len; i++) {
                                        if (matchlink($res_list.eq(i).find('.res-linkinfo cite'))) {
                                            if (!$res_list.eq(0).hasClass('xws-top')) {
                                                var Html = $res_list.eq(0).html();
                                                $res_list.eq(0).html($res_list.eq(i).html()).addClass('xws-top');
                                                $res_list.eq(i).html(Html);
                                            } else {
                                                if (i == res_len) {
                                                    $res_list.eq(i).addClass('xws-top');
                                                } else {
                                                    var Html = objHtml($res_list.eq(i), 'li');
                                                    $res_list.eq(i).remove();
                                                    $('#main ul.result .res-list.xws-top').eq(-1).after(Html);
                                                }
                                            }
                                        }
                                    }
                                } else {
                                    $('#main ul.result').prepend(setTopHtml('so', q));
                                }
                                for (var i = 0; i < $('#main ul.result li').length; i++) {
                                    $('#main ul.result li').eq(i).find('.so-lazyimg').prop('src', $('#main ul.result li').eq(i).attr('data-lazyload', '1')
                                        .find('.so-lazyimg').data('isrc')).removeAttr('data-isrc').removeClass('so-lazyimg').css('opacity', '1').attr('data-lazyload', '1');
                                }
                            }
                        }
                    }

                    // 必应置顶
                    function bingSetTop() {
                        var q = getUrlKey(window.location.href, 'q');
                        try {
                            if (q) {
                                q = q.replace(/\s*/g, "");
                            }
                        } catch (e) {
                        }
                        if (setTopType(q) || matchlink($('#b_results cite'))) {
                            $('ol#b_results li.b_ad').remove();
                            if (!$('#b_results .xws-top').length) {
                                if (matchlink($('#b_results .b_attribution cite'))) {
                                    var $b_algo = $('#b_results .b_algo');
                                    var algo_len = $b_algo.length;
                                    for (var i = 0; i <= algo_len; i++) {
                                        if (matchlink($b_algo.eq(i).find('.b_attribution cite'))) {
                                            if (!$b_algo.eq(0).hasClass('xws-top')) {
                                                var Html = $b_algo.eq(0).html();
                                                $b_algo.eq(0).html($b_algo.eq(i).html()).addClass('xws-top');
                                                $b_algo.eq(i).html(Html);
                                            } else {
                                                if (i == algo_len) {
                                                    $b_algo.eq(i).addClass('xws-top');
                                                } else {
                                                    var Html = objHtml($b_algo.eq(i), 'li');
                                                    $b_algo.eq(i).remove();
                                                    $('#b_results .xws-top').eq(-1).after(Html);
                                                }
                                            }
                                        }
                                    }
                                } else {
                                    $('#b_results').prepend(setTopHtml('bing', q));
                                }
                            }
                        }
                    }

                    // 搜狗置顶
                    function sogouSetTop() {
                        var query = getUrlKey(window.location.href, 'query');
                        try {
                            if (query) {
                                query = query.replace(/\s*/g, "");
                            }
                        } catch (e) {
                        }
                        if (setTopType(query) || matchlink($('#main a.cite,#main cite'))) {
                            $('.sponsored').css('display', 'none');
                            if (!$('.results .xws-top').length) {
                                if (matchlink($('.results cite'))) {
                                    for (var i = 0; i < $('.results>div').length; i++) {
                                        if (matchlink($('#cacheresult_info_' + i))) {
                                            if (!$('.results>div').eq(0).hasClass('xws-top')) {
                                                var Html = $('.results>div').eq(0).html();
                                                $('.results>div').eq(0).html($('.results>div').eq(i).html()).addClass('xws-top');
                                                $('.results>div').eq(i).html(Html);
                                            } else {
                                                if (i == $('.results>div').length) {
                                                    $('.results>div').eq(i).addClass('xws-top');
                                                } else {
                                                    var Html = objHtml($('.results>div').eq(i), 'div');
                                                    $('.results>div').eq(i).remove();
                                                    $('.results>div.xws-top').eq(-1).after(Html);
                                                }
                                            }
                                        }
                                    }
                                } else {
                                    $('#main .results').prepend(setTopHtml('sogou', query));
                                }
                            }
                        }
                    }

                    // 匹配搜索关键词
                    function setTopType(str) {
                        if (!str) return false;
                        for (var cp_type in keywords_list) {
                            if (keywords_list[cp_type].includes(str)) {
                                return cp_type;
                            } else {
                                for (var i = 0; i < keywords_list[cp_type].length; i++) {
                                    if (str.indexOf(keywords_list[cp_type][i]) >= 0) {
                                        return cp_type;
                                    }
                                }
                            }
                        }
                        return false;
                    }

                    // // 匹配是否是我们的产品
                    // function setTopType(str) {
                    //     if (!str) return false;
                    //
                    //     for (var cp_type in keywords_list) {
                    //         if (keywords_list[cp_type].includes(str)) {
                    //             return cp_type;
                    //         } else {
                    //             for (var i = 0; i < keywords_list[cp_type].length; i++) {
                    //                 if (str.indexOf(keywords_list[cp_type][i]) >= 0) {
                    //                     return cp_type;
                    //                 }
                    //             }
                    //         }
                    //     }
                    //     return false;
                    // }

                    // 匹配快照左侧的链接是否是我们自己的链接
                    function matchlink(obj) {
                        var linkList = ['xiaowangshen.com', 'dianshangyi.net', 'dianshangyi.com', 'duoduocha.com', 'kandianbao.com', 'dianzhentan.com', 'wangtanzhang.com', 'wangcanmou.com', 'doushangyan.com', 'huoyankan.com', 'xuedianshang.com', '//dianshuju.com'];
                        var lType = false;
                        for (var i = 0; i < linkList.length; i++) {
                            if (obj.text().indexOf(linkList[i]) >= 0) {
                                lType = true;
                                break;
                            }
                        }
                        if (!lType && res.ml && res.ml.length) {
                            for (var i = 0; i < res.ml.length; i++) {
                                if (obj.text().indexOf(res.ml[i]) >= 0) {
                                    lType = true;
                                    break;
                                }
                            }
                        }
                        return lType;
                    }

                    // 返回对象自身的html
                    function objHtml(obj, node) {
                        var attrList = obj.get(0).attributes;
                        var attrLen = attrList.length;
                        var attrHtml = '';
                        for (var i = 0; i < attrLen; i++) {
                            attrHtml += ' ' + attrList[i]['localName'] + '="' + attrList[i]['nodeValue'] + (attrList[i]['localName'] == 'class' ? ' xws-top' : '') + '"';
                        }
                        var Html = '<' + node + attrHtml + '>' + obj.html() + '</' + node + '>';
                        return Html;
                    }

                    // 置顶的html
                    function setTopHtml(type, kw) {
                        var itype = setTopType(kw);
                        if (itype == '' || !kw) return '';
                        var strList = formatStr(kw, 2);
                        var regexp = new RegExp(kw, 'g');
                        var setTypeObj = {
                            "xws": [
                                {
                                    "showurl": "https://xiaowangshen.com/",
                                    "url": "https://xiaowangshen.com/?dzt=cj-top",
                                    "h": "小旺神插件官网_新版生意参谋指数一键还原_指数转换_指数还原",
                                    'fh': "小旺神插件官网_生意参谋指数转换_",
                                    "p": "小旺神为您提供新版生意参谋指数一键还原,包括小旺神插件生意参谋指数还原、生意参谋指数解析、生意参谋指数换算、生意参谋数据下载,让你电商生意旺旺旺!",
                                    "bdkz": "http://cache.baiducontent.com/c?m=9f65cb4a8c8507ed19fa950d100b9d3d4a09c5306082914f28888448e435061e5a72a6e667741f13a2ce6b1372b83f5cfd873665367337c79bdff93dcaca943f5f8b3035000bf04505a313b8ba3532b556&amp;p=b4788615d9c041ae4381c7710f6488&amp;newp=8034c54ad5c340fd34b6c7710f5fa5231610db2151d1d101298ffe0cc4241a1a1a3aecbf2224160fd1c2776205a44c5eeff13d763d0034f1f689df08d2ecce7e7de47c&amp;user=baidu&amp;fm=sc&amp;query=%C9%FA%D2%E2%B2%CE%C4%B1%D6%B8%CA%FD&amp;qid=9d01bea9000accc7&amp;p1=17",
                                    "sogoukz": "http://snapshot.sogoucdn.com/websnapshot?ie=utf8&url=https%3A%2F%2Fxiaowangshen.com%2F&did=fabdc02f4b511a2f-e205bee92e12f2db-b4b4d0a6492bfcca009a42a1839e9175&k=48444d90f7c1342d6d7345eac157fb7e&encodedQuery=%E5%B0%8F%E6%97%BA%E7%A5%9E&query=%E5%B0%8F%E6%97%BA%E7%A5%9E&&w=01020400&m=0&st=1",
                                    "sokz": "http://c.360webcache.com/c?m=ee994c0a37b2d13b21b83a3c22184cc5&q=%E5%B0%8F%E6%97%BA%E7%A5%9E&u=https%3A%2F%2Fxiaowangshen.com%2F",
                                },
                                {
                                    "url": "https://xiaowangshen.com/?dzt=cj-top",
                                    "showurl": "https://xiaowangshen.com/",
                                    "imgurl": "https://ss3.baidu.com/-rVXeDTa2gU2pMbgoY3K/it/u=1920263512,1173139111&fm=202&mola=new&crop=v1",
                                    "h": "小旺神插件官网_新版生意参谋指数一键还原_指数转换_指数还原",
                                    'fh': "小旺神插件官网_生意参谋指数转换_",
                                    "p": "小旺神为您提供新版生意参谋指数一键还原,包括小旺神插件生意参谋指数还原、生意参谋指数解析、生意参谋指数换算、生意参谋数据下载,让你电商生意旺旺旺!",
                                    "bdkz": "http://cache.baiducontent.com/c?m=9f65cb4a8c8507ed19fa950d100b9d3d4a09c5306082914f28888448e435061e5a72a6e667741f13a2ce6b1372b83f5cfd873665367337c79bdff93dcaca943f5f8b3035000bf04505a313b8ba3532b556&amp;p=b4788615d9c041ae4381c7710f6488&amp;newp=8034c54ad5c340fd34b6c7710f5fa5231610db2151d1d101298ffe0cc4241a1a1a3aecbf2224160fd1c2776205a44c5eeff13d763d0034f1f689df08d2ecce7e7de47c&amp;user=baidu&amp;fm=sc&amp;query=%C9%FA%D2%E2%B2%CE%C4%B1%D6%B8%CA%FD&amp;qid=9d01bea9000accc7&amp;p1=17",
                                    "sogoukz": "http://snapshot.sogoucdn.com/websnapshot?ie=utf8&url=https%3A%2F%2Fxiaowangshen.com%2F&did=fabdc02f4b511a2f-e205bee92e12f2db-b4b4d0a6492bfcca009a42a1839e9175&k=48444d90f7c1342d6d7345eac157fb7e&encodedQuery=%E5%B0%8F%E6%97%BA%E7%A5%9E&query=%E5%B0%8F%E6%97%BA%E7%A5%9E&&w=01020400&m=0&st=1",
                                    "sokz": "http://c.360webcache.com/c?m=ee994c0a37b2d13b21b83a3c22184cc5&q=%E5%B0%8F%E6%97%BA%E7%A5%9E&u=https%3A%2F%2Fxiaowangshen.com%2F",
                                }
                            ],
                            "ddc": [
                                {
                                    "showurl": "https://duoduocha.com/",
                                    "url": "https://duoduocha.com/?dzt=cj-top",
                                    "h": "多多查官网_拼多多商家数据查询分析免费在线卖家工具",
                                    "fh": "多多查官网_拼多多商家数据查询分析_",
                                    "p": "多多查是拼多多数据分析工具,免费提供拼多多商家在线查询工具,提供关键词排名,类目排名,活动排名,店铺监控,商品监控,排名监控,商品市场、商品销量、价格分布、关键词...",
                                    "bdkz": "http://cache.baiducontent.com/c?m=9f65cb4a8c8507ed19fa950d100b81214402c73e6d8d83027fa3c215cc794f041a26b5b430521413a4c76b1705b83e5efdf14665470337c090&p=97769a47808a1cf908e2977e065c8b&newp=86759a46d6c806fa11b3852d021486231610db2151d4db01298ffe0cc4241a1a1a3aecbf2225120fd4c67b6201a44858edfa3d723d0034f1f689df08d2ecce7e68dd6e6a61&user=baidu&fm=sc&query=%B6%E0%B6%E0%B2%E9&qid=b68e1b35003157c6&p1=1",
                                    "sokz": "http://c.360webcache.com/c?m=a8d09650bfcbd25b267b748210204f25&q=%E5%A4%9A%E5%A4%9A%E6%9F%A5&u=https%3A%2F%2Fduoduocha.com%2F",
                                    "sogoukz": "http://snapshot.sogoucdn.com/websnapshot?ie=utf8&url=http%3A%2F%2Fduoduocha.com%2F&did=6c8863ff401dff11-4063d2ef28740ecb-fe3fca242a6fa49435b67f124ed10b8c&k=6d595d503f52b4ae0f9e4cb422939fdc&encodedQuery=%E5%A4%9A%E5%A4%9A%E6%9F%A5&query=%E5%A4%9A%E5%A4%9A%E6%9F%A5&&w=01020400&m=0&st=1",
                                }
                            ],
                            "dsyan": [
                                {
                                    "showurl": "https://doushangyan.com/",
                                    // "imgurl": "",
                                    "url": "https://doushangyan.com/?dzt=cj-top",
                                    "h": "抖商眼-抖音电商数据分析工具",
                                    "fh": "抖商眼-抖音电商数据分析工具_",
                                    "p": "抖商眼是国内领先的视频数据开放平台,依托领先的数据挖掘与分析能力,为视频内容创作者在创作和用户运营方面提供数据支持,为广告主的广告投放提供数据参考和效果监测,...",
                                    "bdkz": "http://cache.baiducontent.com/c?m=9d78d513d9d431ab4f9d90690c66c0171243f1122bd6a00209d7843ee3701c011969b9fd61605113d2b6617a57f20e1db0a36a277c507ca09bbfd91782a6&p=84769a4786cc41af0afec86f1347&newp=8664c64ad4db08ff57ed9437165092695d0fc20e3bd3d201298ffe0cc4241a1a1a3aecbf2225120fd4c67b6201a44858edfa3d723d0034f1f689df08d2ecce7e37c1&user=baidu&fm=sc&query=%B6%B6%C9%CC%D1%DB&qid=98d5ae77003ae555&p1=1",
                                    "sokz": "http://c.360webcache.com/c?m=7591d0ce5c682071b783aeae9372fc65&q=%E6%8A%96%E5%95%86%E7%9C%BC&u=https%3A%2F%2Fdoushangyan.com%2F",
                                    "sogoukz": "http://snapshot.sogoucdn.com/websnapshot?ie=utf8&url=https%3A%2F%2Fdoushangyan.com%2F&did=a13b326b3c3168df-8e24f4fe4f00bb46-06c6afd428af0960d7f3e6c257c11a23&k=e38eec2939b36f36c60f4babc53556aa&encodedQuery=%E6%8A%96%E5%95%86%E7%9C%BC&query=%E6%8A%96%E5%95%86%E7%9C%BC&&w=01020400&m=0&st=1",
                                },
                                {
                                    "showurl": "https://doushangyan.com/",
                                    // "imgurl": "",
                                    "url": "https://doushangyan.com/?dzt=cj-top",
                                    "h": "抖商眼-抖音生意参谋,专注提升抖音带货视频转化率",
                                    "fh": "抖商眼-抖音生意参谋_",
                                    "p": "专业的抖音电商工具分析工具,提供抖音热门商品排行榜,抖音热门预测,达人与商品的监控分析等功能,帮助达人与商家更好等运营抖音号,实现流量变现",
                                    "bdkz": "http://cache.baiducontent.com/c?m=9d78d513d9d431ab4f9d90690c66c0171243f1122bd6a00209d7843ee3701c011969b9fd61605113d2b6617a57f20e1db0a36a277c507ca09bbfd91782a6&p=b4769a4786cc41af43f382665f49&newp=c9769a47cc934eaf58aac93d110592695d0fc20e3bd3d201298ffe0cc4241a1a1a3aecbf22251207d6cf7a620ba5495debf23d723d0034f1f689df08d2ecce7e35&user=baidu&fm=sc&query=%B6%B6%C9%CC%D1%DB&qid=b5458c630002df4d&p1=1",
                                    "sokz": "http://c.360webcache.com/c?m=7591d0ce5c682071b783aeae9372fc65&q=%E6%8A%96%E5%95%86%E7%9C%BC&u=https%3A%2F%2Fdoushangyan.com%2F",
                                    "sogoukz": "http://snapshot.sogoucdn.com/websnapshot?ie=utf8&url=https%3A%2F%2Fdoushangyan.com%2F&did=a13b326b3c3168df-8e24f4fe4f00bb46-06c6afd428af0960d7f3e6c257c11a23&k=e38eec2939b36f36c60f4babc53556aa&encodedQuery=%E6%8A%96%E5%95%86%E7%9C%BC&query=%E6%8A%96%E5%95%86%E7%9C%BC&&w=01020400&m=0&st=1",
                                },
                            ],
                            "dsy": [
                                {
                                    "showurl": "https://dianshangyi.com/",
                                    "imgurl": "",
                                    "url": "https://chajian.dianshangyi.com/?dzt=cj-top",
                                    "h": "电商易插件中心-店侦探插件看店宝插件看店宝软件官网下载",
                                    "fh": "电商易插件中心_",
                                    "p": "电商易插件中心-看店宝插件和店侦探插件是[kandianbao.com]推出的强大淘宝运营工具,可以分析淘宝搜索、详情页、店铺和活动效果页面,获取竞争对手爆款词,而且是永久...",
                                    "bdkz": "http://cache.baiducontent.com/c?m=9f65cb4a8c8507ed4fece76310408c354515da3060829b4e68d4e419ce3b4655023ba3ed28356003c4b2797070a45e2d9be73702207520a0edcd&p=c639c64ad4911be508e2937d4248&newp=8a769a4783d25aff57ea9725564c92695c16ed643fc3864e1290c408d23f061d4866e0be23281605d6c0797347c2080ba8ff612e615631ac&user=baidu&fm=sc&query=%B5%E7%C9%CC%D2%D7&qid=8de409b80006d0e2&p1=1",
                                    "sokz": "http://c.360webcache.com/c?m=ea56c52e97bdcfbd64b99e83e5f27d99&q=%E7%94%B5%E5%95%86%E6%98%93&u=https%3A%2F%2Fdianshangyi.com%2F",
                                    "sogoukz": "http://snapshot.sogoucdn.com/websnapshot?ie=utf8&url=https%3A%2F%2Fdianshangyi.com%2F&did=5e89202ff152101f-5a43e13ea84c0054-b387b2ab5ecd730a2b4efab1e3314a2d&k=e41e9f86175dc0313d378fb5d3127761&encodedQuery=%E7%94%B5%E5%95%86%E6%98%93&query=%E7%94%B5%E5%95%86%E6%98%93&&w=01020400&m=0&st=1",
                                },
                                {
                                    "showurl": "https://dianshangyi.com/",
                                    "imgurl": "",
                                    "url": "https://chajian.dianshangyi.com/?dzt=cj-top",
                                    "h": "电商数据分析工具，店铺数据分析-洞悉竞争对手-监控对手店铺",
                                    "fh": "电商数据分析工具_",
                                    "p": "电商数据分析工具提供电商店铺数据排行，行业分析，店铺分析，宝贝分析，上下架分析,上新查询今日销量查询,对手销量查询,对手改价查询,竞店竞品随时监测智能助理,电商数据...",
                                    "bdkz": "http://cache.baiducontent.com/c?m=9f65cb4a8c8507ed4fece76310408c354515da3060829b4e68d4e419ce3b4655023ba3ed28356003c4b2797070a45e2d9be73702207520a0edcd&p=c639c64ad4911be508e2937d4248&newp=8a769a4783d25aff57ea9725564c92695c16ed643fc3864e1290c408d23f061d4866e0be23281605d6c0797347c2080ba8ff612e615631ac&user=baidu&fm=sc&query=%B5%E7%C9%CC%D2%D7&qid=8de409b80006d0e2&p1=1",
                                    "sokz": "http://c.360webcache.com/c?m=ea56c52e97bdcfbd64b99e83e5f27d99&q=%E7%94%B5%E5%95%86%E6%98%93&u=https%3A%2F%2Fdianshangyi.com%2F",
                                    "sogoukz": "http://snapshot.sogoucdn.com/websnapshot?ie=utf8&url=https%3A%2F%2Fdianshangyi.com%2F&did=5e89202ff152101f-5a43e13ea84c0054-b387b2ab5ecd730a2b4efab1e3314a2d&k=e41e9f86175dc0313d378fb5d3127761&encodedQuery=%E7%94%B5%E5%95%86%E6%98%93&query=%E7%94%B5%E5%95%86%E6%98%93&&w=01020400&m=0&st=1",
                                },
                            ],
                            "dzt": [
                                {
                                    "showurl": "https://www.dianzhentan.com/",
                                    "imgurl": "https://ss0.baidu.com/6ONWsjip0QIZ8tyhnq/it/u=4031402193,2157973710&fm=85&app=79&f=JPEG?w=121&h=75&s=2EE2E516FC61FE1141FC7FFE03007036",
                                    "url": "https://www.dianzhentan.com/?dzt=cj-top",
                                    "h": "店侦探-电商数据分析专家 店侦探-电商数据分析专家 ",
                                    "fh": "店侦探-电商数据分析专家_",
                                    "p": "店侦探是一款能全面跟踪天猫淘宝店铺的运营数据工具,提供爆款关注,标题改动跟踪,改价跟踪,淘宝活动跟踪、自然搜索排名跟踪,直通车关键词排名跟踪等功能。",
                                    "bdkz": "http://cache.baiducontent.com/c?m=9d78d513d9d431a84f9ae7690c66c0101e43f7122ba6a1020fa2870fd33a541b0120a1fa30236319ce80392216af3e0ab1a36a3a6d547cf1c8949f4aaaeacf7732&p=aa64f90a85cc43bc1ebd9b7d0f1096&newp=ce6ac54ad5c147e044bfc7710f0e8d231610db2151d4d3126b82c825d7331b001c3bbfb42327160ed2c4766002a9435debf534723d0923a3dda5c91d9fb4c57479c73b66&user=baidu&fm=sc&query=%B5%EA%D5%EC%CC%BD&qid=d6d9b28b00008f6a&p1=2",
                                    "sokz": "http://c.360webcache.com/c?m=a708ee0ba3400aa42315cf251e658084&q=%E5%BA%97%E4%BE%A6%E6%8E%A2&u=https%3A%2F%2Fwww.dianzhentan.com%2F",
                                    "sogoukz": "http://snapshot.sogoucdn.com/websnapshot?ie=utf8&url=https%3A%2F%2Fwww.dianzhentan.com%2F&did=fb9aecb92a5654b4-e8b63a3e9cc56a5b-0a89dbb444162eefe73c860ef1ebb0db&k=6ad733d16c8bf3a07fbb1af256a98c35&encodedQuery=%E5%BA%97%E4%BE%A6%E6%8E%A2&query=%E5%BA%97%E4%BE%A6%E6%8E%A2&&w=01020400&m=0&st=1",
                                },
                                {
                                    "showurl": "https://www.dianzhentan.com/",
                                    // "imgurl": "https://ss0.baidu.com/6ONWsjip0QIZ8tyhnq/it/u=4031402193,2157973710&fm=85&app=79&f=JPEG?w=121&h=75&s=2EE2E516FC61FE1141FC7FFE03007036",
                                    "url": "https://www.dianzhentan.com/?dzt=cj-top",
                                    "h": "店侦探-电商数据分析专家 店侦探-电商数据分析专家 ",
                                    "fh": "店侦探-电商数据分析专家_",
                                    "p": "店侦探是一款能全面跟踪天猫淘宝店铺的运营数据工具,提供爆款关注,标题改动跟踪,改价跟踪,淘宝活动跟踪、自然搜索排名跟踪,直通车关键词排名跟踪等功能。",
                                    "bdkz": "http://cache.baiducontent.com/c?m=9d78d513d9d431a84f9ae7690c66c0101e43f7122ba6a1020fa2870fd33a541b0120a1fa30236319ce80392216af3e0ab1a36a3a6d547cf1c8949f4aaaeacf7732&p=aa64f90a85cc43bc1ebd9b7d0f1096&newp=ce6ac54ad5c147e044bfc7710f0e8d231610db2151d4d3126b82c825d7331b001c3bbfb42327160ed2c4766002a9435debf534723d0923a3dda5c91d9fb4c57479c73b66&user=baidu&fm=sc&query=%B5%EA%D5%EC%CC%BD&qid=d6d9b28b00008f6a&p1=2",
                                    "sokz": "http://c.360webcache.com/c?m=a708ee0ba3400aa42315cf251e658084&q=%E5%BA%97%E4%BE%A6%E6%8E%A2&u=https%3A%2F%2Fwww.dianzhentan.com%2F",
                                    "sogoukz": "http://snapshot.sogoucdn.com/websnapshot?ie=utf8&url=https%3A%2F%2Fwww.dianzhentan.com%2F&did=fb9aecb92a5654b4-e8b63a3e9cc56a5b-0a89dbb444162eefe73c860ef1ebb0db&k=6ad733d16c8bf3a07fbb1af256a98c35&encodedQuery=%E5%BA%97%E4%BE%A6%E6%8E%A2&query=%E5%BA%97%E4%BE%A6%E6%8E%A2&&w=01020400&m=0&st=1",
                                },
                            ],
                            "kdb": [
                                {
                                    "showurl": "https://www.kandianbao.com/",
                                    "imgurl": "https://ss0.baidu.com/6ONWsjip0QIZ8tyhnq/it/u=1860502659,1088140177&fm=58&s=FC5BEF16DC604E114846FDFE03009039&bpow=121&bpoh=75",
                                    "url": "https://www.kandianbao.com/?dzt=cj-top",
                                    "h": "看店宝官网_淘宝店铺和天猫数据查询分析免费淘宝卖家工具",
                                    "fh": "看店宝官网_免费淘宝卖家工具",
                                    "p": "看店宝-淘宝数据分析工具,免费提供淘宝商家在线查询工具,全方位剖析店铺运营瓶颈,解开标杆店铺的经营秘密,掌控竞争对手店铺的实时销售数据、广告投放、活动推广、买家...",
                                    "bdkz": "http://cache.baiducontent.com/c?m=9d78d513d9d431db4f9d92690c66c0161e43f7102bd6a0020fd7843b97701c011969b9fd61605113d2b6617a44ea0c4bea876f216b557be4c798db17cabbe57972d73a&p=ce759a45d58212a05afbca12490e&newp=9c6ac64ad4934eaf5bf1db3d4d0092695d0fc20e3bd0db01298ffe0cc4241a1a1a3aecbf2225120fd4c67b6201a44858edfa3d723d0034f1f689df08d2ecce7e&user=baidu&fm=sc&query=%BF%B4%B5%EA%B1%A6&qid=e8cae75c00287e9a&p1=1",
                                    "sokz": "http://c.360webcache.com/c?m=05ea937b81de258775f7d2a8063cc326&q=%E7%9C%8B%E5%BA%97%E5%AE%9D&u=https%3A%2F%2Fwww.kandianbao.com%2F",
                                    "sogoukz": "http://snapshot.sogoucdn.com/websnapshot?ie=utf8&url=https%3A%2F%2Fwww.kandianbao.com%2F&did=77e0bfe48d532b88-9a2fa25d721a2dcc-a876dea0980082ebf759521499e2fe90&k=0cdf9662475538cfde46caee483952ef&encodedQuery=%E7%9C%8B%E5%BA%97%E5%AE%9D&query=%E7%9C%8B%E5%BA%97%E5%AE%9D&&w=01020400&m=0&st=1",
                                },
                                {
                                    "showurl": "www.kandianbao.com/",
                                    // "imgurl": "https://ss0.baidu.com/6ONWsjip0QIZ8tyhnq/it/u=1860502659,1088140177&fm=58&s=FC5BEF16DC604E114846FDFE03009039&bpow=121&bpoh=75",
                                    "url": "https://www.kandianbao.com/?dzt=cj-top",
                                    "h": "看店宝官网_淘宝店铺和天猫数据查询分析免费淘宝卖家工具",
                                    "fh": "看店宝官网_免费淘宝卖家工具",
                                    "p": "看店宝-淘宝数据分析工具,免费提供淘宝商家在线查询工具,全方位剖析店铺运营瓶颈,解开标杆店铺的经营秘密,掌控竞争对手店铺的实时销售数据、广告投放、活动推广、买家...",
                                    "bdkz": "http://cache.baiducontent.com/c?m=9f65cb4a8c8507ed19fa950d100b92235c43801465848c432487cf18c0394c413037bee43a3655599393737071db5e2cece73702207327a0ecbb9f4badace22b38fb23&p=9a769a47998709b508e2947d454c&newp=8578cd0ac78512a05abd9b7e0e4c92695d0fc20e3bd0db01298ffe0cc4241a1a1a3aecbf22241a01d5c77b6700aa4c5ceef23c743d0034f1f689df08d2ecce7e&user=baidu&fm=sc&query=%BF%B4%B5%EA%B1%A6&qid=b09011d7000127af&p1=1",
                                    "sokz": "http://c.360webcache.com/c?m=05ea937b81de258775f7d2a8063cc326&q=%E7%9C%8B%E5%BA%97%E5%AE%9D&u=https%3A%2F%2Fwww.kandianbao.com%2F",
                                    "sogoukz": "http://snapshot.sogoucdn.com/websnapshot?ie=utf8&url=https%3A%2F%2Fwww.kandianbao.com%2F&did=77e0bfe48d532b88-9a2fa25d721a2dcc-a876dea0980082ebf759521499e2fe90&k=0cdf9662475538cfde46caee483952ef&encodedQuery=%E7%9C%8B%E5%BA%97%E5%AE%9D&query=%E7%9C%8B%E5%BA%97%E5%AE%9D&&w=01020400&m=0&st=1",
                                },
                            ],
                            "hyk": [
                                {
                                    "showurl": "https://huoyankan.com/",
                                    // "imgurl": "",
                                    "url": "https://huoyankan.com/?dzt=cj-top",
                                    "h": "火眼看-短视频创作、运营、营销分析平台",
                                    "fh": "火眼看-短视频创作、运营、营销分析平台",
                                    "p": "火眼看是一个帮助短视频创作者涨粉丝,提高点赞、评论、分享和转发的数据分析平台,依托领先的数据挖掘与分析能力,为视频内容创作者在创作和用户运营方面提供数据支持,...",
                                    "bdkz": "http://cache.baiducontent.com/c?m=9d78d513d9d431df4f9996697b15c010694381132ba7a4020fd2870fd33a541b0120a1fa30236319ce9f3b3a4afc1505b9ac217240527de886&p=8678d01b86cc45af00b1c7710f50&newp=8d67c64ad49257e008e2907e446492695d0fc20e38d5d201298ffe0cc4241a1a1a3aecbf22241a05d2cf7b6407a5485deff236783d0034f1f689df08d2ecce7e7e9e68&user=baidu&fm=sc&query=%BB%F0%D1%DB%BF%B4&qid=cfef2785000277df&p1=2",
                                    "sokz": "http://c.360webcache.com/c?m=99abe0b0b95ec4b5e4190b1896e7b3b1&q=%E7%81%AB%E7%9C%BC%E7%9C%8B&u=https%3A%2F%2Fhuoyankan.com%2F",
                                    "sogoukz": "http://snapshot.sogoucdn.com/websnapshot?ie=utf8&url=http%3A%2F%2Fhuoyankan.com%2F&did=cc1a0375742c0de1-56b532865fe4711a-7549033c27651416ef734cfc435e609b&k=ca4bf0d263e404e1ba1d4707ba1d3d7f&encodedQuery=%E7%81%AB%E7%9C%BC%E7%9C%8B&query=%E7%81%AB%E7%9C%BC%E7%9C%8B&&w=01020400&m=0&st=1",
                                },
                            ]
                        }
                        if (res.setObj) {
                            try {
                                for (var ptype in res.setObj) {
                                    if (!setTypeObj[ptype]) {
                                        setTypeObj[ptype] = []
                                    }
                                    for (var i = 0; i < res['setObj'][ptype].length; i++) {
                                        setTypeObj[ptype].push(res['setObj'][ptype][i])
                                    }
                                }
                            } catch (e) {
                            }
                        }

                        if (!setTypeObj[itype]) {
                            itype = 'dsy'
                        }
                        var indexs = parseInt(Math.random() * ((setTypeObj[itype].length ? setTypeObj[itype].length - 1 : 0) - 0 + 1) + 0);
                        var setTopHtmlObj = {
                            'bd':
                                '<div class="xws-top" style="margin-bottom: 20px;">' +
                                '<h3 class="t"><a href="' + setTypeObj[itype][indexs]['url'] + '-bd' + '" target="_blank;">' + setTypeObj[itype][indexs]['h'] + '</a></h3>' +
                                (setTypeObj[itype][indexs]['imgurl'] ? ('<div class="c-row c-gap-top-small"><div class="general_image_pic c-span6">' +
                                    '<a href="' + setTypeObj[itype][indexs]['url'] + '-bd' + '" class="c-img6" style="height: 75px;" target="_blank">' +
                                    '<img src="' + (setTypeObj[itype][indexs]['imgurl'] ? setTypeObj[itype][indexs]['imgurl'] : '') + '" class="c-img c-img6"></a></div>' +
                                    '<div class="c-span18 c-span-last"><div class="c-abstract">' + setTypeObj[itype][indexs]['p'] + '</div>' +
                                    '<div class="f13"><a target="_blank" href="' + setTypeObj[itype][indexs]['url'] + '-bd' + '" class="c-showurl" style="text-decoration:none;">' + setTypeObj[itype][indexs]['showurl'] + '&nbsp;</a>' +
                                    '<div class="c-tools" data-tools="{title:\'' + setTypeObj[itype][indexs]['h'] + '\',url:\'' + setTypeObj[itype][indexs]['showurl'] + '\'}"><a class="c-tip-icon"><i class="c-icon c-icon-triangle-down-g"></i></a></div>' +
                                    '&nbsp;-&nbsp;<a data-click="{\'rsv_snapshot\':\'1\'}" href="' + setTypeObj[itype][indexs]['bdkz'] + '" target="_blank" class="m">百度快照</a></div></div></div>') : (
                                    '<div class="c-abstract">' + setTypeObj[itype][indexs]['p'] + '</div>' +
                                    '<div class="f13"><a target="_blank" href="' + setTypeObj[itype][indexs]['url'] + '-bd' + '" class="c-showurl" style="text-decoration:none;">' + setTypeObj[itype][indexs]['showurl'] + '&nbsp;</a>' +
                                    '<div class="c-tools" id="tools_4429574991562571016_1" data-tools="{title:\'' + setTypeObj[itype][indexs]['h'] + '\',url:\'' + setTypeObj[itype][indexs]['showurl'] + '\'}">' +
                                    '<a class="c-tip-icon"><i class="c-icon c-icon-triangle-down-g"></i></a>' +
                                    '</div>&nbsp;-&nbsp;<a data-click="{\'rsv_snapshot\':\'1\'}" href="' + setTypeObj[itype][indexs]['bdkz'] + '" target="_blank" class="m">百度快照</a></div></div></div>'
                                )),
                            'sogou':
                                '<div class="rb">' +
                                '<h3 class="pt">' +
                                '<a name="dttl" target="_blank" href="' + setTypeObj[itype][indexs]['url'] + '-sogou' + '" >' + setTypeObj[itype][indexs]['h'] + '</a>' +
                                '</h3>' + (setTypeObj[itype][indexs]['imgurl'] ? ('<div><div class="str_div">' +
                                '<a class="str_img size_120_80" target="_blank" href="' + setTypeObj[itype][indexs]['url'] + '-sogou' + '">' +
                                '<img src="' + setTypeObj[itype][indexs]['imgurl'] + '" width="120" height="80"></a></div>' +
                                '<div class="str_info_div"><p class="str_info">' + setTypeObj[itype][indexs]['p'] + '</p><div class="fb">' +
                                '<cite id="cacheresult_info_0">' + setTypeObj[itype][indexs]['showurl'] + '&nbsp;-&nbsp;1天前</cite>&nbsp;-&nbsp;' +
                                '<a target="_blank" style="color:#666" href="' + setTypeObj[itype][indexs]['sogoukz'] + '">快照</a></div></div></div>') : ('<div class="ft">' + setTypeObj[itype][indexs]['p'] + '</div><div class="fb">' +
                                '<cite id="cacheresult_info_0">' + setTypeObj[itype][indexs]['showurl'] + '&nbsp;-&nbsp;1天前</cite>&nbsp;-&nbsp;' +
                                '<a target="_blank" style="color:#666" href="' + setTypeObj[itype][indexs]['sogoukz'] + '">快照</a></div></div>'))
                            ,
                            'so':
                                '<li class="res-list xws-top">' +
                                '<h3 class="res-title ">' +
                                '<a href="' + setTypeObj[itype][indexs]['url'] + '-so' + '" target="_blank">' + setTypeObj[itype][indexs]['h'] + '</a></h3>' +
                                (setTypeObj[itype][indexs]['imgurl'] ? ('<div class="res-rich so-rich-news clearfix"><div class="res-comm-img">' +
                                    '<a href="' + setTypeObj[itype][indexs]['url'] + '-so' + '" target="_blank"><img src="' + setTypeObj[itype][indexs]['imgurl'] + '" width="120" height="80"></a>' +
                                    '</div><div class="res-comm-con">' + setTypeObj[itype][indexs]['p'] + '<p class="res-linkinfo"><cite>' + setTypeObj[itype][indexs]['showurl'] + '</cite>-' +
                                    '<a href="' + setTypeObj[itype][indexs]['sokz'] + '" target="_blank" class="m">快照</a></p></div></div>') : ('<p class="res-desc">' + setTypeObj[itype][indexs]['p'] + '</p>' +
                                    '<p class="res-linkinfo"><cite>' + setTypeObj[itype][indexs]['showurl'] + '</cite>-<a href="' + setTypeObj[itype][indexs]['sokz'] + '" target="_blank" class="m">快照</a></p></li>'))
                            ,
                            'bing':
                                '<li class="b_algo xws-top">' +
                                '<h2><a target="_blank" href="' + setTypeObj[itype][indexs]['url'] + '-bing' + '">' + setTypeObj[itype][indexs]['h'] + '</a></h2>' +
                                '<div class="b_caption"><p>' + setTypeObj[itype][indexs]['p'] + '</p>' +
                                '<div class="b_attribution"><cite>' + setTypeObj[itype][indexs]['showurl'] + '</cite></div></div></li>'
                            ,
                        }
                        var red_beg = 'em';
                        if (type == 'bing') {
                            red_beg = 'strong';
                        }
                        var topHtml = setTopHtmlObj[type];
                        if (check_rivals(kw)) {
                            return topHtml;
                        } else if (topHtml.indexOf(kw) >= 0) {
                            topHtml = topHtml.replace(regexp, '<' + red_beg + '>' + kw + '</' + red_beg + '>');
                        } else {
                            var reg_true = false;
                            for (var i = 0; i < strList.length; i++) {
                                if (topHtml.indexOf(strList[i]) >= 0) {
                                    reg_true = true;
                                }
                                regexp = new RegExp(strList[i], 'g');
                                topHtml = topHtml.replace(regexp, '<' + red_beg + '>' + strList[i] + '</' + red_beg + '>');
                            }
                        }
                        return topHtml
                    }

                    function check_rivals(kw) {
                        if (!kw) return false;
                        for (var i = 0; i < rivals_list.length; i++) {
                            if (rivals_list.indexOf(kw) >= 0) {
                                return true;
                            }
                        }
                        return false;
                    }
                }

                function check_domain() {
                    var dzt_load_href = window.location.href;
                    var domain_list = ['www.baidu.com', 'www.so.com/s?', 'www.sogou.com/sogou?', 'www.sogou.com/sie?', 'www.sogou.com/web?', '//cn.bing.com/search?'];
                    for (var i = 0; i < domain_list.length; i++) {
                        if (dzt_load_href.indexOf(domain_list[i]) >= 0) {
                            return true;
                        }
                    }
                    try {
                        if (res.c_d && res.c_d.length) {
                            for (var i = 0; i < res.c_d.length; i++) {
                                if (dzt_load_href.indexOf(res.c_d[i]) >= 0) {
                                    return true;
                                }
                            }
                        }
                    } catch (e) {

                    }
                    return false;
                }

                function formatStr(str, num) {
                    var array = new Array();
                    if (!str) return array;
                    str = str.replace(/\s*/g, "");
                    var len = str.length;
                    for (var i = 0; i < (len / num); i++) {
                        if ((i + 1) * num > len) {
                            if (!array.includes(str.substring(i * num, len))) {
                                array.push(str.substring(i * num, len));
                            }
                        } else {
                            if (!array.includes(str.substring(i * num, (i + 1) * num))) {
                                array.push(str.substring(i * num, (i + 1) * num));
                            }
                        }

                    }
                    return array;
                }

                if (data.dzt_sosuo_update.update.split('_')[0] == '1') {
                    try {
                        if ((res.ver && (res.ver < data.dzt_sosuo_update.ver)) || !res.ver) {
                            $.get('https://ssl.dianzhentan.com/api/4.0/topdata/', function (ret) {
                                if (ret['data']) {
                                    dzt_local.set({'dzt_sosuo_data': ret['data']});
                                }
                            });
                        }
                    } catch (e) {

                    }
                }
            });
        }
    }
});


